Skip to content

Allow with custom cabal path #25

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jun 19, 2025
Merged

Conversation

tbidne
Copy link
Contributor

@tbidne tbidne commented Jun 16, 2025

Hopefully resolves #24.

@sheaf does this work for you? I believe your previous example:

> my-own-cabal --store-dir=my_store_dir build clc-stackage --keep-going

would now be (--keep-going is on by default):

> clc-stackage --cabal-path=path/to/my-own-cabal --cabal-options='--store-dir=path/to/my_store_dir'

Unfortunately testing this is a bit hard at the moment, as stackage's json endpoint is currently unreliable. I just ran it and made sure the cabal arguments looked reasonable.

Edit: I have realized it's pretty easy to make this more robust wrt stackage flakiness, so I'll try to add that to this PR as well.

Allows usage with custom cabal path. Additionally, adds general
--cabal-options argument, for passing through arbitrary cabal options.

The latter subsumes the --jobs and --cabal-verbosity args, hence they
are removed. The previous behavior can be achieved with e.g.

  clc-stackage --cabal-options='--jobs=semaphore --verbose=1'
@tbidne tbidne marked this pull request as draft June 17, 2025 01:58
@tbidne tbidne marked this pull request as ready for review June 17, 2025 07:25
@tbidne
Copy link
Contributor Author

tbidne commented Jun 17, 2025

The second commit is technically unrelated to the linked issue, though I think it is useful to include here.

When the default stackage json endpoint fails, fallback to trying
the <snapshot>/cabal.config endpoint. The latter seems more reliable.

This also allows us to easily add a --snapshot-path CLI arg, giving
users the ability to pass in a snapshot file manually.
@sheaf
Copy link

sheaf commented Jun 17, 2025

This looks very useful. I will try to use it today and will report back. Thanks a lot.

Cabal constraints, like those returned from stackage's cabal.config
endpoint, can specify packages in a number of ways, including
e.g. 'mtl installed'. Previously we were ignoring such constraints.

We now parse these too.
tbidne added 2 commits June 18, 2025 11:55
Using megaparsec was probably overkill, as the constraint parsing is
simple enough that we can do it with text without too much
trouble.
Displayed package names (stdout, log directory names) now use a hyphen
e.g. aeson-1.2.3, rather than reusing the default delimiter == e.g.
aeson ==1.2.3.
@tbidne
Copy link
Contributor Author

tbidne commented Jun 18, 2025

Assuming this solves the stated problem, I am satisfied with the PR. I do have one more commit that I'd like to merge at some point -- it consolidates the multiple libraries into a single one (imo an improvement for several reasons) -- but I'll refrain from pushing it up until there is consensus on what is up, since the filepath renaming probably ruins the diff.

@sheaf
Copy link

sheaf commented Jun 18, 2025

I tested this patch, but couldn't get the store-dir argument to work. I think the issue is that store-dir is a global argument that should be passed before the command, i.e. the cabal-install invocation should be of the form cabal --store-dir=... build and not cabal build --store-dir=....

@tbidne
Copy link
Contributor Author

tbidne commented Jun 19, 2025

Ah, you are exactly right. I just added a new --cabal-global-options for this, and it worked for me with custom cabal and store directory. So your example is now:

> clc-stackage --cabal-path=path/to/my-own-cabal --cabal-global-options='--store-dir=path/to/my_store_dir'

@sheaf
Copy link

sheaf commented Jun 19, 2025

Very good, thank you.

@Bodigrim Bodigrim merged commit 34c9cf1 into haskell:master Jun 19, 2025
3 checks passed
@Bodigrim
Copy link
Collaborator

Amazing, thanks @tbidne.

@tbidne tbidne deleted the custom-cabal branch June 20, 2025 02:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Latest refactor makes this repository harder to use for smoke-testing cabal
3 participants